<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>电影</title>
</head>

<body>
	<form method="get" action="MoviePageServlet">
		<p>
			电影分类： <select name="cid">
				<option value=0>所有分类</option>
				<c:forEach items="${category}" var="c">
					<option>${c.name }</option>
				</c:forEach>
			</select> &nbsp;&nbsp; 电影名称：<input type="text" name="title" /> &nbsp;&nbsp; <input
				type="submit" name="submit" value="搜索" />
		</p>
		<hr />
		<table border="1">
			<tr>
				<th>ID</th>
				<th>电影名称</th>
				<th>电影编号</th>
				<th>导演</th>
				<th>上映时间</th>
			</tr>
			<%--     <%for(Movie m : moviesList){ %>
    <tr>
    	<td><%=m.getId()%></td>
    	<td><%=m.getTitle() %></td>
    	<td><%=m.getMovieCode() %></td>
    	<td><%=m.getDirector() %></td>
    	<td><%=m.getDateReleased() %></td>
    </tr>
    <%} %> --%>
			<c:forEach items="${movie}" var="m">
				<tr>
					<td>${m.id}</td>
					<td>${m.title}</td>
					<td>${m.movieCode}</td>
					<td>${m.director}</td>
					<td>${m.dateReleased}</td>
				</tr>
			</c:forEach>
		</table>
		<hr />
		<%-- 	<% if(pageNum>1) {%>
	<a href="MoviePage.jsp?page=<%=pageNum-1%>&cid=<%=cid%>&title=<%=title%>">上一页</a>
	<% }%>
	<% if(pageNum<totalPage) { %>
	<a href="MoviePage.jsp?page=<%=pageNum+1%>&cid=<%=cid%>&title=<%=title%>">下一页</a>
	<% }%>
	| 共<%=totalPage%>页,第<%=pageNum %>页 --%>


	</form>
</body>
</html>
<c:if test="${param.pageNum>1}">
	<a
		href="MoviePage.jsp?page=${param.pageNum1 + 1 }&cid=${param.cid }&title=${param.title}">上一页</a>
</c:if>
<c:if test="${param.pageNum < param.totalPage}">
	<a
		href="MoviePage.jsp?page=${param.pageNum-1 }&cid=${param.cid }&title=${param.title}">上一页</a>
</c:if>

	| 共${param.totalPage }页,第${param.pageNum }页
